﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Task.Common.Interface;
using Common.Service;
using System.Collections;
using Task.Common.Entity;

namespace Task.AjaxPage
{
    public partial class GetExtCondition : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string processid=Request ["ProcessID"];
            IProcessBusinessFields fields = ServiceContainer.GetService<IProcessBusinessFields>();
            int count=0;
            IList list = fields.GetList(processid, 0, 10,out count);
            string returnString = String.Empty;
            string strTR1 = "<tr>";
            string strTR2 = "<tr>";
            for (int i = 0; i < list.Count; i++)
            {
                ProcessBusinessFieldsEntity entity = (ProcessBusinessFieldsEntity)list[i];
                strTR1 += "<td>"+entity.FIELD_CNAME+"</td>";
                if (entity.CONTROL_TYPE == "1")//文本框
                {
                    strTR2 += "<td><input type='text' id='"+entity.FIELD_NAME+"' class='inputBorder' runat='server' /></td>";
                }
                if (entity.CONTROL_TYPE == "2")//时间框
                {
                    strTR2 += "<td><input class='Wdate inputboder1' type='text' runat='server'/>-<input class='Wdate inputboder1' type='text' runat='server'/></td>";
                }
                if (entity.CONTROL_TYPE == "3")//下拉框
                {
                    strTR2 += "<td><select  id='"+entity.FIELD_NAME+"' class='inputBorder' style='height:22px;'><option value=''>请选择...</option></select></td>";
                }
                if (entity.CONTROL_TYPE == "4")//选择框
                {
                    strTR2 += "<td><input type='text' id='" + entity.FIELD_NAME + "' class='inputBorder' runat='server' /><img src='images/iconlabel2.gif' /></td>";
                }
                
            }
            returnString = strTR1+"</tr>" + strTR2+"</tr>";
            Response.Write(returnString);
            Response.End();
        }
    }
}